package com.ruoyi.ring.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.ring.domain.HealthQuestion;
import com.ruoyi.ring.mapper.HealthQuestionMapper;
import com.ruoyi.ring.service.IHealthQuestionService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 健康问卷Service业务层处理
 * 
 * @author liuwp
 * @date 2025-07-29
 */
@Service
public class HealthQuestionServiceImpl implements IHealthQuestionService 
{
    @Resource
    private HealthQuestionMapper healthQuestionMapper;

    /**
     * 查询健康问卷
     * 
     * @param id 健康问卷主键
     * @return 健康问卷
     */
    @Override
    public HealthQuestion selectHealthQuestionById(Long id)
    {
        return healthQuestionMapper.selectHealthQuestionById(id);
    }

    /**
     * 查询健康问卷列表
     * 
     * @param healthQuestion 健康问卷
     * @return 健康问卷
     */
    @Override
    public List<HealthQuestion> selectHealthQuestionList(HealthQuestion healthQuestion)
    {
        return healthQuestionMapper.selectHealthQuestionList(healthQuestion);
    }

    /**
     * 根据业务主键查询一条记录：健康问卷
     *
     * @param healthQuestion 健康问卷
     * @return 健康问卷
     */
    @Override
    public HealthQuestion selectOneHealthQuestion(HealthQuestion healthQuestion)
    {
        return healthQuestionMapper.selectOneHealthQuestion(healthQuestion);
    }

    /**
     * 新增健康问卷
     * 
     * @param healthQuestion 健康问卷
     * @return 结果
     */
    @Override
    public int insertHealthQuestion(HealthQuestion healthQuestion)
    {
        healthQuestion.setCreateTime(DateUtils.getNowDate());
        return healthQuestionMapper.insertHealthQuestion(healthQuestion);
    }

    /**
     * 修改健康问卷
     * 
     * @param healthQuestion 健康问卷
     * @return 结果
     */
    @Override
    public int updateHealthQuestion(HealthQuestion healthQuestion)
    {
        healthQuestion.setUpdateTime(DateUtils.getNowDate());
        return healthQuestionMapper.updateHealthQuestion(healthQuestion);
    }

    @Override
    public int updateHealthQuestionCondition(HealthQuestion healthQuestion, HealthQuestion healthQuestionCondition)
    {
                healthQuestion.setUpdateTime(DateUtils.getNowDate());
        return healthQuestionMapper.updateHealthQuestionCondition(healthQuestion, healthQuestionCondition);
    }

    /**
     * 批量删除健康问卷
     * 
     * @param ids 需要删除的健康问卷主键
     * @return 结果
     */
    @Override
    public int deleteHealthQuestionByIds(Long[] ids)
    {
        return healthQuestionMapper.deleteHealthQuestionByIds(ids);
    }

    /**
     * 删除健康问卷信息
     * 
     * @param id 健康问卷主键
     * @return 结果
     */
    @Override
    public int deleteHealthQuestionById(Long id)
    {
        return healthQuestionMapper.deleteHealthQuestionById(id);
    }

    /**
     * 条件删除健康问卷
     *
     * @param healthQuestion 健康问卷
     * @return 结果
     */
    @Override
    public int deleteHealthQuestionByCondition(HealthQuestion healthQuestion)
    {
        return healthQuestionMapper.deleteHealthQuestionByCondition(healthQuestion);
    }

}
